const fp = require('lodash/fp');

class IO {
  static of (value) {
    return new IO(function () {
      return value;
    })
  }

  constructor (fn) {
    this._value = fn;
  }

  map (fn) {
    // 把当前的fn 和 this._value 组合
    return new IO(fp.flowRight(fn, this._value));
  }
}

const r = IO.of(process).map(p => p.execPath);

console.log(r._value());